The solution provided is remarkably simple: you add an extra if statement to the else clause. 提供的解决方案非常简单:给else子句添加一个额外的if语句。
If none of the conditions are true, it will execute the "else" action, if one is present, and then continue executing lines following the entire "if, elif, else" statement. 如果没有条件为真,则将执行“else”操作,如果有一个条件为真,则继续执行整个“if,elif,else”语句之后的行。
The while loop, as was the case with the if statement, supports an optional else clause containing a block of program statements executed when the expression is False. while循环与if语句一样,支持一个可选的else子句,其中包含一个当表达式计算为False时执行的程序语句块。
The if statement supports an optional else clause that indicates a block of program statements that should be processed if the Boolean expression evaluates False. if语句支持一个可选的else子句,指示当布尔表达式计算为False时应该处理的程序语句块。